<template>
	<div class="container">
		<!-- 主导航栏 -->
		<ul class="main-tabs clearfix"
			v-show="userinfos.account!='fcwlhyg' && headerTitle!='合同查询' &&headerTitle!='发票查询'&&headerTitle!='平台资质'  ">
			<li v-for="(item,index) in mainTabs.data" :key="index" :class="{active:index==mainTabs.index}"
				@click="mainTabSwitch(index)">{{item.title}}</li>
		</ul>
		<!-- 头部信息 -->
		<h3 class="header-title clearfix">
			<span class="border"></span>
			<p>{{headerTitle}}</p>

		</h3>
		<!-- 搜索栏 -->
		<comSearch v-if="mainTabs.index == 3" :options="searchData" @search="searchList"
			v-show="headerTitle!='合同查询'&&headerTitle!='发票查询'&&headerTitle!='平台资质'"></comSearch>
		<!-- 副导航栏 -->
		<comNavTabs :navList="navList" @switch="tabSwitch"
			v-show="headerTitle!='合同查询'&&headerTitle!='发票查询' &&headerTitle!='平台资质'">
		</comNavTabs>
		<!-- 数据展示的列表 -->
		<comTable :options="tableList" @openFlexDialog="openFlexDialog" @openRegDialog="openRegDialog"
			v-show="headerTitle!='合同查询'&&headerTitle!='发票查询' &&headerTitle!='平台资质'" @openFailsDialog="openFailsDialog"
			@openIntentionDialog=openIntentionDialog @openUserinfo="openUserinfo"
			@openQRcodeDialog="function(data){return openUploadDialog('QRcode',data)}"
			@openLicenseDialog="function(data){return openUploadDialog('license',data)}"
			@openCollectionAccount="openCollectionAccount" @cancellationData="cancellationData"
			@delListData="delListData" @modifyFlexDialog="modifyFlexDialog"></comTable>
		<!-- 需求详情模板 -->
		<flexDemand :options="flexDemand" :type="mainTabs.index" :nav="navList.index" :individual.sync="flexDemand.type"
			@cooperatFail="cooperatFail" @cooperatPass="cooperatPass" @cooperatDouble="cooperatDouble"
			@cooperatEnd="cooperatEnd" @breakOff="function(){breakOffContract('解约')}"
			@reject="function(){breakOffContract('驳回')}" @confirm="function(){breakOffContract('确认解约')}"
			@updateData="updateData"></flexDemand>
		<!-- 个体商户注册信息 -->
		<flexRegisterMsg :options="registerMsg" :nav="navList.index"></flexRegisterMsg>
		<!-- 申报失败弹窗 -->
		<flexUnsuccessful :options="unsuccessfulData" @subFailData="subFailData"></flexUnsuccessful>
		<!-- 添加认证二维码和电子营业执照弹窗 -->
		<flexUpload :options="uploadData" @subUploadData="subUploadData"></flexUpload>
		<!-- 收款账户弹窗 -->
		<flexCollectAccount :options="collectionAccountData"></flexCollectAccount>
		<!-- 灵活就业收入-手动录入弹窗 -->
		<flexManualEntry ref="entryDialog" :options="entryData" @submitEntry="function(form){submitEntry(form,'手动')}">
		</flexManualEntry>
		<!-- 导入弹窗数据展示模板 -->
		<flexImportTemplate :options="templateData" @screenData="function(form){screenData(form,'批量')}">
		</flexImportTemplate>
		<!-- 分页器 -->
		<el-pagination @size-change="handleSizeChange" @current-change="pageChange" :current-page.sync="cur"
			v-show="headerTitle!='合同查询'&&headerTitle!='发票查询' &&headerTitle!='平台资质'" :page-sizes="[10, 20, 30, 50, 100]"
			:page-size="pageSize" layout="total, sizes, prev, pager, next, jumper" :total="totalNum" background>
		</el-pagination>


		<div v-show="headerTitle=='平台资质'" class="zizhi">
			<div class="items">
				<p>备案与版权</p>
				<div class="itemBox">
					<h4>
						<span>名称</span>
						<span>操作</span>
					</h4>

					<div class="content">
						<div>
							<span>互联网备案信息</span>
							<span @click="openImg('互联网备案信息')">点击查看</span>
						</div>
						<div>
							<span>版权认证证书</span>
							<span @click="openImg('版权认证证书')">点击查看</span>
						</div>
					</div>
				</div>
			</div>
			<div class="items">
				<p>软著</p>
				<div class="itemBox">
					<h4>
						<span>名称</span>
						<span>操作</span>
					</h4>
					<div class="content">
						<div>
							<span>app</span>
							<span @click="openImg('app')">点击查看</span>
						</div>
						<div>
							<span>后台</span>
							<span @click="openImg('后台')">点击查看</span>
						</div>
						<div>
							<span>企业端</span>
							<span @click="openImg('企业端')">点击查看</span>
						</div>
					</div>
				</div>
			</div>
			<div class="items">
				<p>营业执照许可证</p>
				<div class="itemBox">
					<h4>
						<span>名称</span>
						<span>操作</span>
					</h4>
					<div class="content">
						<div>
							<span>营业执照</span>
							<span @click="openImg('营业执照')">点击查看</span>
						</div>
					</div>
				</div>
			</div>
		</div>

		<el-dialog :title="imgTitle" :visible.sync="imgShow" width="45%" :before-close="handleClose" :center="imgShow">
			<div class="imgBox">
				<img :src="imgUrl" alt="">
			</div>

		</el-dialog>
		<el-dialog :visible.sync="userShow" width="45%" :before-close="handleClose" :center="imgShow">
			<div class="userBox">
				<div class="userItem">
					<h3>个人信息</h3>
					<p>姓名：{{accountInfo.businessmanName}}</p>
					<p>手机号码：{{accountInfo.telenum}}</p>
					<p style="width: 300px;">身份证号码：{{accountInfo.identity}}</p>
				</div>

			</div>

			<div class="userBox">
				<div class="userItem">
					<h3>账户信息</h3>
					<p>收款银行：{{accountInfo.dueBank}}</p>
					<p>开户行：{{accountInfo.openingBank}}</p>
					<p>收款户名：{{accountInfo.paymentAccount}}</p>
					<p style="width: 300px;margin-right: -100px;">收款账户：{{accountInfo.shroffAccount}}</p>
				</div>

			</div>

			<div class="userBox">
				<div class="userItem">
					<h3>明细流水</h3>
					<div class="list" v-for="item in accountList">
						<div class="listItem">{{item.projectName}}</div>
						<div class="listItem" style="margin-left: 92px;">{{item.createTime}}</div>
						<div class="listItem" style="color: red; width: 80px;">+{{item.revenue}}</div>
					</div>
				</div>

			</div>

		</el-dialog>



	</div>



	</div>
</template>

<script>
	import jobsData from '../../assets/jobs.json';
	export default {
		components: {
			comNavTabs: () => import("@/household/common/comNavTabs.vue"),
			comSearch: () => import("@/component/common/comSearch.vue"),
			comImport: () => import("@/component/common/comImport.vue"),
			comTable: () => import("@/household/common/comTable.vue"),
			flexDemand: () => import("@/component/flexible/flexDemand.vue"),
			flexManualEntry: () => import("@/component/flexible/flexManualEntry.vue"),
			flexRegisterMsg: () => import("@/component/flexible/flexRegisterMsg.vue"),
			flexUnsuccessful: () => import("@/component/flexible/flexUnsuccessful.vue"),
			flexUpload: () => import("@/component/flexible/flexUpload.vue"),
			flexCollectAccount: () => import("@/component/flexible/flexCollectAccount.vue"),
			flexImportTemplate: () => import("@/component/flexible/flexImportTemplate.vue"),
		},
		data() {
			return {
				imgTitle: '',
				imgUrl: "../../assets/img/beian.png",
				userShow: false,
				accountInfo:{},
				accountList:[],
				imgShow: false,
				/* 主导航栏列表数据 */
				userinfos: {},
				mainTabs: {
					index: 0, //当前是在哪个tab栏
					data: [{
							title: '企业查询'
						},
						{
							title: '任务查询'
						},
						{
							title: '自然人查询'
						},
						{
							title: '结算查询'
						},
					]
				},
				headerTitle: '企业需求', //头部标题
				/* 副导航栏列表数据 */
				navList: {
					index: 0, //当前是在哪个tab栏
					data: [{
							title: '待处理'
						},
						{
							title: '未达成合作'
						},
						{
							title: '合作中'
						},
						{
							title: '已完成'
						}
					]
				},
				/* 手动录入数据 */
				entryData: {
					showDialog: false, //显示

				},
				/* 导入数据 */
				importData: {

				},
				/* 搜索栏数据 */
				searchData: {
					noUserName: true, //会员名称
					noProjectName: true, //项目名称
					noCardnum: true, //身份证号码
					noTime: true, //时间段

					searchInfo: {}, //搜索信息
				},
				/* 表格数据 */
				tableList: {
					list: [{
							title: '企业名称',
							prop: 'companyName',
							isClick: false
						},
						{
							title: '联系人手机',
							prop: 'telnum',
							isClick: false
						},
						{
							title: '提交时间',
							prop: 'createTime',
							isClick: false
						},
						{
							title: '需求主题',
							prop: 'projectName',
							isClick: false
						},
						{
							title: '费用标准',
							prop: 'costStandard',
							isClick: false
						},
					],
					noOperation: true, //是否有操作项
					operation: [ //操作项内容
						{
							name: '操作',
							isBtn: false,
							title: 'openFlexDialog'
						}
					],
					data: [
						/* {
							companyName: '上海天都人力资源有限公司',
							telnum: '15202120781',
							createTime: '2020-10-12',
							projectName: '帮助公司设计官方网站',
							costStandard: '5000元',
						} */
					]
				},
				/* 需求详情模板数据 */
				flexDemand: {
					showDialog: false, //显示
					type: '', //类型
					mold: '', //合作中还是修改数据
					projectMsg: {
						/* companyName: '天都人力资源有限公司',					//公司名称
						companyAddress: '上海-上海-闵行区',						//公司地址
						telnum: '13434343434',									//电话号码
						projectName: '网站界面设计ui',							//主题
						contentStandard: '好嗨呀',								//服务内容标准
						personnelStandard: '感觉人生达到了高潮',					//服务人员标准
						cost: '500',											//费用标准
						settlement: '日结',										//结算方式 */
					},
					dataList: [
						/* {
							userName: '张三',
							operatingResult: '未达成',
							createTime: '2020-10-12',
							postscript: '资料不全，费用太低了',
						} */
					],
				},
				/* 个体商户注册信息数据 */
				registerMsg: {
					showDialog: false, //显示
					userInfo: {
						/* userName: '张三',										//姓名
						telenum: '13434343434',									//手机号码
						cardnum: '315151515151515',								//身份证号码
						applicantCompany: '天都人力资源有限公司',					//公司名称
						industry: '物流',										//行业
						identitya: 'https://tiandufacai-1259220846.cos.ap-shanghai.myqcloud.com/newimg/766661474528526336.jpg',
						identityb: 'https://tiandufacai-1259220846.cos.ap-shanghai.myqcloud.com/newimg/766661474528526336.jpg',
						serviceCharge: 'https://tiandufacai-1259220846.cos.ap-shanghai.myqcloud.com/newimg/766661474528526336.jpg', */
					}
				},
				/* 申报失败数据 */
				unsuccessfulData: {
					showDialog: false, //显示
					title: '', //标题
					userInfo: {}, //用户数据
					eventName: 'subFailData', //事件名称
				},
				/* 上传文件数据 */
				uploadData: {
					showDialog: false, //显示
					title: '添加认证二维码', //弹窗标题
					fileList: [], //图片列表
					type: '', //上传类型:营业执照或二维码
					userInfo: {}, //用户信息
				},
				/* 收款账户数据 */
				collectionAccountData: {
					showDialog: false, //显示
					userInfo: {}, //用户信息
				},
				templateData: {
					showDialog: false, //显示
					tableList: [], //校验之后的数据
				},


				/* 分页功能数据 */
				cur: 1,
				pageSize: 10,
				totalNum: 0, //总共有多少条数据,根据这个数据去适配页数
			}


		},

		watch: {
			$route(to, from) {
				// console.log(to.path);
				let routerObj = this.$route
				console.log(routerObj);
				if (routerObj.params.mark == 'companySearch') {
					this.mainTabSwitch(0);
				} else if (routerObj.params.mark == 'peopleSearch') {
					this.mainTabSwitch(2);
				} else if (routerObj.params.mark == 'jobSearch') {
					this.mainTabSwitch(1);
				} else if (routerObj.params.mark == 'computerSearch') {
					this.mainTabSwitch(3);
				} else if (routerObj.params.mark == 'PlatformQualification') {
					this.headerTitle = '平台资质'
				} else if (routerObj.params.mark == 'billSearch') {
					this.headerTitle = '发票查询'
				} else if (routerObj.params.mark == 'contactSearch') {
					this.headerTitle = '合同查询'
				}


			}

		},

		created() {
			let routerObj = this.$route
			if (routerObj.params.mark == 'companySearch') {
				this.mainTabSwitch(0);
			} else if (routerObj.params.mark == 'peopleSearch') {
				this.mainTabSwitch(2);
			} else if (routerObj.params.mark == 'jobSearch') {
				this.mainTabSwitch(1);
			} else if (routerObj.params.mark == 'computerSearch') {
				this.mainTabSwitch(3);
			} else if (routerObj.params.mark == 'PlatformQualification') {
				this.headerTitle = '平台资质'
			} else if (routerObj.params.mark == 'billSearch') {
				this.headerTitle = '发票查询'
			} else if (routerObj.params.mark == 'contactSearch') {
				this.headerTitle = '合同查询'
			}




			this.userinfos = eval("(" + localStorage.getItem('userinfo') + ")");
			console.log(this.userinfos.account);
			console.log(this.userinfos);
		},
		methods: {
			openUserinfo(data) {
			
				console.log(data);
				this.accountInfo=data
				let params  = {
					businessmanName:data.businessmanName,
					pageNum:1,
					pageSize:10
				}
				this.$flexibleAxios.post('v1/apply/selectAgilityIncomeList',params).then(res=>{
					this.accountList = res.data.data.incomeList
				})
				this.userShow = true;
			},
			openImg(data) {
				this.imgShow = true
				if (data == '互联网备案信息') {
					this.imgUrl = 'https://share.fcw-china.com/img/beian.png';
					this.imgTitle = '互联网备案信息'
				} else if (data == '版权认证证书') {
					this.imgUrl = 'https://share.fcw-china.com/img/banquan.png';
					this.imgTitle = '版权认证证书'
				}
				if (data == 'app') {
					this.imgUrl = 'https://share.fcw-china.com/img/fcwapp.jpeg';
					this.imgTitle = 'app'
				}
				if (data == '后台') {
					this.imgUrl = 'https://share.fcw-china.com/img/fcwht.jpeg';
					this.imgTitle = '后台'
				}
				if (data == '企业端') {
					this.imgUrl = 'https://share.fcw-china.com/img/fcwqyht.jpeg';
					this.imgTitle = '企业端'
				}
				if (data == '营业执照') {
					this.imgUrl = 'https://share.fcw-china.com/img/fcwyyzz.png';
					this.imgTitle = '营业执照'
				}
			},
			handleClose() {
				this.imgShow = false
				this.userShow = false
			},
			/* 头部主tabs栏切换 */
			mainTabSwitch(index) {
				this.mainTabs.index = index;
				this.headerTitle = this.mainTabs.data[index].title;
				if (index == 0) {
					this.navList.data = [{
							title: '待处理'
						},
						{
							title: '未达成合作'
						},
						{
							title: '合作中'
						},
						{
							title: '已完成'
						}
					]
					this.tableList.list = [{
							title: '企业名称',
							prop: 'companyName',
							isClick: false
						},
						{
							title: '联系人手机',
							prop: 'telnum',
							isClick: false
						},
						{
							title: '提交时间',
							prop: 'createTime',
							isClick: false
						},
						{
							title: '需求主题',
							prop: 'projectName',
							isClick: false
						},
						{
							title: '费用标准',
							prop: 'costStandard',
							isClick: false
						},
					]
				} else if (index == 1) {
					this.navList.data = [{
							title: '待处理'
						},
						{
							title: '未达成合作'
						},
						{
							title: '合作中'
						},
						{
							title: '待确认解约'
						},
						{
							title: '中止项目'
						},
						{
							title: '完成项目'
						},

					]
					this.tableList.list = [{
							title: '用户名称',
							prop: 'proName',
							isClick: true,
							eventName: 'openRegDialog'
						},
						{
							title: '联系人手机',
							prop: 'telenum',
							isClick: false
						},
						{
							title: '报名时间',
							prop: 'createTime',
							isClick: false
						},
						{
							title: '需求企业',
							prop: 'companyName',
							isClick: false
						},
						{
							title: '需求主题',
							prop: 'projectName',
							isClick: false
						},
					]
				} else if (index == 2) {
					this.navList.data = [
						// {
						// 	title: '待处理'
						// },
						// {
						// 	title: '个体户注册成功'
						// },
						// {
						// 	title: '个体户申报失败'
						// },
					]

				} else {
					this.navList.data = [];
				}
				this.cur = 1;
				this.pageSize = 10;
				this.tabSwitch(0);
			},
			/* 子tabs栏切换 */
			tabSwitch(index) {
				this.navList.index = index;
				this.tableList.operation.splice(0);
				this.tableList.noProjectStatus = false;
				if (this.mainTabs.index == 0 || this.mainTabs.index == 1) {
					if (index == 0 || index == 2) {
						this.tableList.operation = [{
							name: '操作',
							isBtn: false,
							title: 'openFlexDialog'
						}]
					} else {
						this.tableList.operation = [{
							name: '查看',
							isBtn: false,
							title: 'openFlexDialog'
						}]
					}
					if (index == 2) {
						this.tableList.operation.push({
							name: '修改',
							isBtn: false,
							title: 'modifyFlexDialog'
						})
					}
				} else if (this.mainTabs.index == 2) {
					if (index == 1) {
						this.tableList.list = [{
								title: '会员名称',
								prop: 'userName',
								isClick: false,

							},
							{
								title: '联系人手机',
								prop: 'telenum',
								isClick: false
							},
							{
								title: '提交时间',
								prop: 'createTime',
								isClick: false
							},
							{
								title: '身份证号码',
								prop: 'cardnum',
								isClick: false
							},
							{
								title: '意向合作项目',
								prop: 'projectName',
								isClick: true,
								eventName: 'openIntentionDialog'
							}
						];
						this.tableList.operation = [
							// {
							// 	name: '查看',
							// 	isBtn: false,
							// 	title: 'openRegDialog'
							// },
							{
								name: '收款账户',
								isBtn: false,
								title: 'openCollectionAccount'
							},
							{
								name: '申报失败',
								isBtn: false,
								title: 'openFailsDialog'
							},
							{
								name: '添加认证二维码',
								isBtn: false,
								title: 'openQRcodeDialog'
							},
							{
								name: '添加电子营业执照',
								isBtn: false,
								title: 'openLicenseDialog'
							}
						]
					} else {
						this.tableList.list = [{
								title: '会员名称',
								prop: 'userName',
								isClick: false
							},
							{
								title: '联系人手机',
								prop: 'telenum',
								isClick: false
							},
							{
								title: '提交时间',
								prop: 'createTime',
								isClick: false
							},
							{
								title: '身份证号码',
								prop: 'cardnum',
								isClick: false
							},
						];
						if (index == 0) {
							this.tableList.list.push(
								// {
								// 	title: '项目合作状态',
								// 	prop: 'projectStatus',
								// 	isClick: true,
								// 	eventName: 'openFlexDialog'
								// }
							)
							this.tableList.operation = [
								// {
								// 	name: '查看',
								// 	isBtn: false,
								// 	title: 'openRegDialog'
								// },
								{
									name: '收款账户',
									isBtn: false,
									title: 'openCollectionAccount'
								},
								{
									name: '注销',
									isBtn: false,
									title: 'cancellationData'
								},
							]
						} else {
							this.tableList.operation = [{
									name: '查看',
									isBtn: false,
									title: 'openRegDialog'
								},
								{
									name: '收款账户',
									isBtn: false,
									title: 'openCollectionAccount'
								},
							]
						}

					}
				} else {
					this.tableList.list = [{
							title: '会员名称',
							prop: 'businessmanName',
							isClick: true,
							eventName: 'openUserinfo'
						},
						{
							title: '身份证号码',
							prop: 'identity',
							isClick: false
						},
						{
							title: '项目名称',
							prop: 'projectName',
							isClick: false
						},
						{
							title: '录入日期',
							prop: 'createTime',
							isClick: false
						},
						{
							title: '收入月份',
							prop: 'incomeTime',
							isClick: false
						},
						{
							title: '收入金额',
							prop: 'revenue',
							isClick: false
						},
					];
					this.tableList.operation = [{
						name: '删除',
						isBtn: false,
						title: 'delListData'
					}]
				}
				this.getDataList();
			},
			/* 搜索条件搜索数据 */
			searchList(form) {
				if (form.userName) {
					form.businessmanName = form.userName;
					delete form.userName;
				}
				console.log(form);
				this.searchData.searchInfo = form;
				this.getDataList(this.searchData.searchInfo);
			},
			/* 打开银行收款账户弹窗 */
			openCollectionAccount(data) {
				console.log(data);
				this.collectionAccountData.userInfo = data;
				this.collectionAccountData.showDialog = true;
			},
			/* 获取数据列表 */
			getDataList(form) {
				let params = {
					pageNum: this.cur,
					pageSize: this.pageSize
				}
				let url = '';
				if (this.mainTabs.index == 0) {
					params.cooperation = this.navList.index;
					url = '/v1/demand/selectDemandByList';
				} else if (this.mainTabs.index == 1) {
					params.cooperation = this.navList.index;
					url = '/v1/businessman/selectAgilityApplyList';
				} else if (this.mainTabs.index == 2) {
					params.status = 2;
					url = '/v1/businessman/selectBusinessmanList';
				} else {
					if (form) {
						Object.assign(params, form)
					};
					url = '/v1/apply/selectAgilityIncomeList';
				}
				this.$flexibleAxios.post(url, params).then(res => {
					console.log(res);
					if (res.data.code === 1000) {
						this.tableList.data = [];
						let result = res.data.data;
						this.totalNum = Number(result.totalNum);
						if (this.mainTabs.index == 3) {
							this.tableList.data = result.incomeList;
						} else {
							result.alist.forEach(item => {
								if (item.serviceCharge) {
									if (item.payments == '1') {
										item.costStandard = item.serviceCharge + '元/日';
									} else if (item.payments == '2') {
										item.costStandard = item.serviceCharge + '元/月';
									} else if (item.payments == '3') {
										item.costStandard = item.serviceCharge + '元';
									} else if (item.payments == '4') {
										item.costStandard = item.serviceCharge + '元/小时';
									}
								} else {
									item.costStandard = '-';
								}

								if (item.companyAddPro) {
									item.citys = [item.companyAddPro, item.companyAddCity, item
										.companyAddCounty
									];
								}
								if (item.arrange) {
									let arr = item.arrange.split(';');
									item.arrangeList = [];
									arr.forEach((num, index) => {
										if (num) {
											item.arrangeList.push({
												url: num,
												uid: index
											})
										}
									})
								} else {
									item.arrangeList = [];
								}
								if (item.applyList && item.applyList.length > 0) {
									item.projectStatusList = [];
									item.applyList.forEach(sub => {
										if (sub.cooperation == 0) {
											sub.title = sub.projectName + '(待处理)';
										} else if (sub.cooperation == 1) {
											sub.title = sub.projectName + '(未达成合作)';
										} else if (sub.cooperation == 2) {
											sub.title = sub.projectName + '(合作中)';
										} else if (sub.cooperation == 3) {
											sub.title = sub.projectName + '(确认合同完成)';
										} else if (sub.cooperation == 4) {
											sub.title = sub.projectName + '(合作中止)';
										} else if (sub.cooperation == 5) {
											sub.title = sub.projectName + '(合作中)';
										} else if (sub.cooperation == 6) {
											sub.title = sub.projectName + '(合作中)';
										} else if (sub.cooperation == 7) {
											sub.title = sub.projectName + '(合作中止)';
										}
										item.projectStatusList.push(sub);
									})
								}
								this.tableList.data.push(item);
							})
						}
					} else {
						this.$message({
							message: res.data.message,
							type: 'warning'
						})
					}
				})
			},
			/* 打开需求详情模板 */
			openFlexDialog(data) {
				console.log(data);
				let params = {
					perhapsId: data.demandId,
					distinguish: this.mainTabs.index + 1
				}
				this.$flexibleAxios.post('/v1/demand/selectAgilityOperationList', params).then(res => {
					console.log(res);
					if (res.data.code === 1000) {
						let result = res.data.data;
						this.flexDemand.dataList = result.alist;
					} else {
						this.$message({
							message: res.data.message,
							type: 'warning'
						})
					}
				})

				if (this.mainTabs.index == 0) {
					this.flexDemand.mold = 'default';
					this.flexDemand.projectMsg = data;
					this.flexDemand.showDialog = true;
				} else {
					this.$flexibleAxios.post('/v1/businessman/selectAgilityApplyByapplyId', {
						applyId: data.applyId
					}).then(res => {
						console.log(res);
						if (res.data.code === 1000) {
							let result = res.data.data;
							if (result.payments == '1') {
								result.costStandard = result.serviceCharge + '元/日';
							} else if (result.payments == '2') {
								result.costStandard = result.serviceCharge + '元/月';
							} else if (result.payments == '3') {
								result.costStandard = result.serviceCharge + '元';
							}
							result.citys = [result.companyAddPro, result.companyAddCity, result.companyAddCounty];
							if (result.arrange) {
								let arr = result.arrange.split(';');
								result.arrangeList = [];
								arr.forEach((num, index) => {
									if (num) {
										result.arrangeList.push({
											url: num,
											uid: index
										})
									}
								})
							}
							this.flexDemand.projectMsg = result;
							this.flexDemand.showDialog = true;
						} else {
							this.$message({
								message: res.data.message,
								type: 'warning'
							})
						}
					})
				}
			},
			/* 企业需求-合作中-修改数据 */
			modifyFlexDialog(data) {
				console.log(data);
				this.flexDemand.projectMsg = data;
				this.flexDemand.showDialog = true;
				this.flexDemand.mold = 'modify';
			},
			/* 个体商户认证-待处理-意向合作项目 */
			openIntentionDialog(data) {
				console.log(data);
				this.flexDemand.type = 'individual';
				this.$flexibleAxios.post('/v1/demand/selectAgilityDemandBydemandId', {
					userId: data.userId,
					demandId: data.demandId
				}).then(res => {
					console.log(res);
					if (res.data.code === 1000) {
						let result = res.data.data;
						if (result.companyAddPro) {
							result.citys = [result.companyAddPro, result.companyAddCity, result.companyAddCounty];
						}
						if (result.arrange) {
							let arr = result.arrange.split(';');
							result.arrangeList = [];
							arr.forEach((num, index) => {
								if (num) {
									result.arrangeList.push({
										url: num,
										uid: index
									})
								}
							})
						}
						this.$set(this.flexDemand, 'projectMsg', result);
						this.flexDemand.showDialog = true;
					} else {
						this.$message({
							message: res.data.message,
							type: 'warning'
						})
					}
				})

			},
			/* 打开个体户注册信息模板 */
			openRegDialog(data) {
				console.log(data);
				this.$flexibleAxios.post('/v1/businessman/selectBusinessmanIsTrue', {
					userId: data.userId
				}).then(res => {
					console.log(res);
					if (res.data.code === 1000) {
						let result = res.data.data;
						if (result.industry) {
							let arr1 = eval(result.industry);
							let arr2 = [];
							jobsData.industry.forEach(item1 => {
								arr1.forEach(item2 => {
									if (item1.key == item2) {
										arr2.push(item1.value + '；');
									}
								})
							})
							result.industryList = arr2;
						}
						this.registerMsg.userInfo = result;

						this.registerMsg.showDialog = true;
					} else {
						this.$message({
							message: res.data.message,
							type: 'warning'
						})
					}
				})
			},
			/* 个体商户认证-个体户注册成功-注销功能 */
			cancellationData(data) {
				console.log(data);
				this.$confirm('此操作将删除该账户, 是否继续?', '提示', {
					confirmButtonText: '确定',
					cancelButtonText: '取消',
					type: 'warning'
				}).then(() => {
					this.$flexibleAxios.post('/v1/demand/deleteBusinessman', {
						userId: data.userId
					}).then(res => {
						console.log(res);
						if (res.data.code === 1000) {
							this.getDataList();
							this.$message({
								type: 'success',
								message: '注销成功'
							});
						} else {
							this.$message({
								type: 'warning',
								message: res.data.message
							});
						}
					})

				}).catch(() => {
					this.$message({
						type: 'info',
						message: '已取消注销操作'
					});
				});
			},
			/* 打开申报失败弹窗 */
			openFailsDialog(data) {
				console.log(data);
				this.unsuccessfulData.title = '申报失败';
				this.unsuccessfulData.eventName = 'subFailData';
				this.unsuccessfulData.userInfo = data;
				this.unsuccessfulData.showDialog = true;
			},
			/* 提交企业需求或报名用户-未达成合作数据 */
			cooperatFail(data) {
				console.log(data);
				let params = {
					cooperation: 1,
					postscript: data,
					demandId: this.flexDemand.projectMsg.demandId,
					activeUserId: JSON.parse(localStorage.getItem('userinfo')).userid,
					userName: JSON.parse(localStorage.getItem('userinfo')).username,
				}
				let url = '';
				if (this.mainTabs.index == 0) {
					url = '/v1/demand/updateDemandByCooperation';
				} else {
					url = '/v1/businessman/updateApplyCooperationByApplyId';
					params.applyId = this.flexDemand.projectMsg.applyId;
				}
				this.$flexibleAxios.post(url, params).then(res => {
					console.log(res);
					if (res.data.code === 1000) {
						this.$message({
							message: '操作成功！',
							type: 'success'
						})
						this.flexDemand.showDialog = false;
						this.getDataList();
					} else {
						this.$message({
							message: res.data.message,
							type: 'warning'
						})
					}
				})
			},
			/* 提交报名用户-达成合作数据 */
			cooperatPass(data) {
				console.log(data);
				let params = {
					cooperation: 2,
					postscript: data,
					demandId: this.flexDemand.projectMsg.demandId,
					activeUserId: JSON.parse(localStorage.getItem('userinfo')).userid,
					userName: JSON.parse(localStorage.getItem('userinfo')).username,
					applyId: this.flexDemand.projectMsg.applyId
				}
				this.$flexibleAxios.post('/v1/businessman/updateApplyCooperationByApplyId', params).then(res => {
					console.log(res);
					if (res.data.code === 1000) {
						this.$message({
							message: '操作成功！',
							type: 'success'
						})
						this.flexDemand.showDialog = false;
						this.getDataList();
					} else {
						this.$message({
							message: res.data.message,
							type: 'warning'
						})
					}
				})
			},
			/* 提交企业需求-达成合作及展示数据 */
			cooperatDouble(form) {
				console.log(form);
				let data = {
					cooperation: 2,
					postscript: form.remarks,
					demandId: form.demandId,
					activeUserId: JSON.parse(localStorage.getItem('userinfo')).userid,
					userName: JSON.parse(localStorage.getItem('userinfo')).username,
				}
				this.$flexibleAxios.post('/v1/demand/updateDemandByCooperation', data).then(res => {
					console.log(res);
					if (res.data.code === 1000) {
						this.updateData(form);
					} else {
						this.$message({
							message: res.data.message,
							type: 'warning'
						})
					}
				})
			},
			/* 更新数据 */
			updateData(form) {
				let params = {
					companyAddPro: form.companyAddPro,
					companyAddCity: form.companyAddCity,
					companyAddCounty: form.companyAddCounty,
					detailedAddress: form.detailedAddress,
					projectName: form.projectName,
					contentStandard: form.contentStandard,
					personnelStandard: form.personnelStandard,
					arrange: form.arrange,
					serviceCharge: form.serviceCharge,
					payments: form.payments,
					demandId: form.demandId,
					projectIntroduction: form.projectIntroduction
				}
				this.$flexibleAxios.post('/v1/demand/updateDemand', params).then(res => {
					console.log(res);
					if (res.data.code === 1000) {
						this.$message({
							message: '操作成功！',
							type: 'warning'
						})
						this.flexDemand.showDialog = false;
						this.getDataList();
					} else {
						this.$message({
							message: res.data.message,
							type: 'warning'
						})
					}
				})
			},
			/* 灵活就业-删除数据操作 */
			delListData(data) {
				console.log(data);
				this.$confirm('是否删除此条数据?', '提示', {
					confirmButtonText: '确定',
					cancelButtonText: '取消',
					type: 'warning'
				}).then(() => {
					this.$flexibleAxios.post('/v1/apply/deleteIncomeByIncomeId', {
						incomeId: data.incomeId
					}).then(res => {
						console.log(res);
						if (res.data.code === 1000) {
							this.$message.success('删除成功!');
							this.getDataList(this.searchData.searchInfo);
						} else {
							this.$message.warning(res.data.message);
						}
					})

				}).catch(() => {
					this.$message({
						type: 'info',
						message: '已取消删除'
					});
				});
			},
			/* 企业需求或报名用户-合作中-合作完成操作 */
			cooperatEnd() {
				let params = {},
					url = '';
				if (this.mainTabs.index == 0) {
					params.demandId = this.flexDemand.projectMsg.demandId;
					url = '/v1/demand/updateDemandCooperation';
					this.$flexibleAxios.post(url, params).then(res => {
						console.log(res);
						if (res.data.code === 1000) {
							this.$message({
								message: '操作成功！',
								type: 'success'
							})
							this.flexDemand.showDialog = false;
							this.getDataList();
						} else {
							this.$message({
								message: res.data.message,
								type: 'warning'
							})
						}
					})
				} else {
					/* params.applyId = this.flexDemand.projectMsg.applyId;
					url = '/v1/apply/updateApplyFinish'; */
					this.breakOffContract('确认合作完成');
				}

			},
			/* 报名用户-合作中-解约操作-原因弹窗 */
			breakOffContract(title) {
				this.unsuccessfulData.title = title;
				this.unsuccessfulData.eventName = 'subFailData';
				this.unsuccessfulData.showDialog = true;
			},
			/* 灵活用工就业-提交手动录入数据 和 批量导入数据进行数据校验*/
			submitEntry(arr, type) {
				console.log(arr);
				this.$flexibleAxios.post('/v1/apply/selectIsYes', arr).then(res => {
					console.log(res);
					if (res.data.code === 1000) {
						if (type == '手动') {
							this.entryData.showDialog = false;
							if (res.data.data[0].exit) {
								this.screenData(res.data.data, '手动');
							} else {
								this.$message.warning('录入信息有误，请重新核对后录入');
							}
							this.$refs.entryDialog.resetForm('form');
						} else {
							this.templateData.showDialog = true;
							this.templateData.tableList = res.data.data;
						}
					} else {
						this.$message.warning(res.data.message);
					}


				})
			},
			/* 灵活用工就业-提交筛选过后的导入数据 */
			screenData(arr, type) {
				this.$flexibleAxios.post('/v1/apply/insertIncomeList', arr).then(res => {
					console.log(res);
					if (res.data.code === 1000) {
						this.getDataList(this.searchData.searchInfo);
						this.$message.success('录入成功！');
					} else {
						this.$message.warning(res.data.message);
					}
					if (type == '批量') {
						this.templateData.showDialog = false;
					} else {
						this.entryData.showDialog = false;
					}
				})
			},
			/* 打开上传图片弹窗 */
			openUploadDialog(type, data) {
				console.log(type);
				console.log(data);
				this.uploadData.type = type;
				this.uploadData.userInfo = data;
				if (type == 'QRcode') {
					this.uploadData.title = '添加认证二维码';
					if (data.personnelStandard) {
						this.uploadData.fileList.push({
							name: 'code.jpg',
							url: data.personnelStandard
						});
					} else {
						this.uploadData.fileList = [];
					}
				} else {
					this.uploadData.title = '添加电子营业执照';
					this.uploadData.fileList = [];
				}

				this.uploadData.showDialog = true;
			},
			/* 提交申报失败数据 */
			subFailData(data) {
				let params = {
						contentStandard: data,
						applyId: this.flexDemand.projectMsg.applyId
					},
					url = '';
				if (this.unsuccessfulData.title == '驳回') {
					url = '/v1/apply/insertTerminateBhJy';
				} else if (this.unsuccessfulData.title == '解约') {
					url = '/v1/apply/backgroundTerminate';
				} else if (this.unsuccessfulData.title == '确认解约') {
					url = '/v1/apply/insertTerminateTyJy';
				} else if (this.unsuccessfulData.title == '确认合作完成') {
					url = '/v1/apply/updateApplyFinish';
					params.finishPostscript = data;
					delete params.contentStandard;
				} else {
					params = {
						businessmanId: this.unsuccessfulData.userInfo.businessmanId,
						userId: this.unsuccessfulData.userInfo.userId,
						postscript: data
					};
					url = '/v1/businessman/updateBusinessmanStatus';
				}
				this.$flexibleAxios.post(url, params).then(res => {
					console.log(res);
					if (res.data.code === 1000) {
						this.$message.success('操作成功！');
						this.flexDemand.showDialog = false;
						/* if(this.unsuccessfulData.title == '驳回' || this.unsuccessfulData.title == '解约' || this.unsuccessfulData.title == '确认解约'){
							this.flexDemand.showDialog = false;
						} */
						this.unsuccessfulData.showDialog = false;
						this.getDataList();
					} else {
						this.$message({
							message: res.data.message,
							type: 'warning'
						})
					}
				})
			},
			/* 提交认证二维码或电子营业执照图片 */
			subUploadData(data) {
				console.log(data);
				let params = {
					businessmanId: this.uploadData.userInfo.businessmanId,
					userId: this.uploadData.userInfo.userId,
				}
				let url = '';
				if (this.uploadData.type == 'QRcode') {
					params.personnelStandard = data;
					url = '/v1/businessman/updatePersonnelStandard';
				} else {
					params.serviceCharge = data.url;
					params.applicantCompany = data.applicantCompany;
					url = '/v1/businessman/updateServiceCharge';
				}
				this.$flexibleAxios.post(url, params).then(res => {
					console.log(res);
					if (res.data.code === 1000) {
						this.$message({
							message: '信息上传成功！',
							type: 'success'
						})
						this.uploadData.showDialog = false;
						this.getDataList();
					} else {
						this.$message({
							message: res.data.message,
							type: 'warning'
						})
					}
				})
			},

			//当前页是第几页,点击的第几页的时候调用这个函数
			pageChange(p) {
				// 点击的时候传过来一个参数，这个参数就是所点击的当前页数，
				// 然后把这个当前页数转换成字符串形式赋值给page，
				// 然后把page这个参数传给search这个方法
				console.log(p);
				this.cur = p;
				this.getDataList();
			},
			//每页有多少条,10,20,50等,点击选择的时候调用这个方法
			handleSizeChange(val) {
				console.log(val);
				this.pageSize = val;
				this.getDataList();
			},
		}
	}
</script>

<style scoped="scoped">
	.container {
		background-color: #fff;
		height: 100%;
		padding-left: 20px;
	}

	.zizhi {
		width: 1400px;
		display: flex;
		height: 800px;
		margin: 40px 100px;
	}

	.itemBox {
		border: 1px solid rgb(198, 198, 198);
		margin: 14px 10px;

	}

	.content {
		height: 330px;
		margin-top: 10px;
	}

	.imgBox img {
		width: 100%;
		margin-top: -24px;

	}

	.userBox {
		width: 850px;
		margin: 0 auto;

	}

	.userBox .userItem {
		width: 700px;
		margin: 0 auto;
	}

	.listItem {
		display: inline-block;
		width: 200px;
		font-size: 16px;
		font-weight: 600;
		margin-bottom: 20px;
		font-family: PingFangSC-Regular, sans-serif;


	}

	.userItem p {
		display: inline-block;
		width: 240px;
		margin-right: 100px;
		font-size: 16px;
		font-weight: 600;
		font-family: PingFangSC-Regular, sans-serif;
		margin-bottom: 17px;

	}

	.userItem>h3 {
		text-align: center;
		font-size: 18px;
		font-weight: bold;
		padding: 20px 0px;
	}

	.content div {
		height: 52px;
		line-height: 52px;
		padding: 0 20px;
	}

	.itemBox h4 {
		height: 45px;
		line-height: 45px;
		padding: 0 15px;
		background-color: rgb(238, 241, 248);
		border-bottom: 1px solid rgb(198, 198, 198);
	}

	

	/deep/ .el-dialog__title {
		/* line-height: 24px; */
		font-size: 18px;
		color: #303133;
		margin-top: 20px !important;
		/* line-height: 43px; */
		height: 60px;
		line-height: 60px;
		font-size: 22px;
		font-weight: bold;
	}
	.itemBox span:first-child {
		float: left;
	}

	.itemBox span:last-child {
		float: right;
	}

	.content span:first-child {
		float: left;
	}

	.content span:last-child {
		float: right;
		background-color: rgb(1, 48, 250);
		color: white;
		height: 25px;
		line-height: 25px;
		border-radius: 10px;
		font-size: 14px;
		cursor: pointer;
		padding: 0 10px;
		margin-top: 10px;

	}


	.zizhi>.items {
		width: 423px;
		height: 476px;
		border: 1px solid rgb(198, 198, 198);
		border-radius: 15px;
		margin: 0 20px;
	}

	.zizhi>.items p {
		text-align: center;
		font-size: 18px;
		font-weight: bold;
		border-bottom: 1px solid rgb(218, 218, 218);
		height: 30px;
		height: 48px;
		line-height: 48px;
	}

	.main-tabs {
		background-color: #EFF1F8;
		margin-bottom: 20px;
		margin-left: -20px;
		padding-left: 50px;
	}

	.main-tabs li {
		height: 40px;
		line-height: 40px;
		float: left;
		margin: 10px 20px;
		padding: 0 30px;
		cursor: pointer;
	}

	.main-tabs .active {
		background: #0064E4;
		border-radius: 20px;
		color: #fff;
	}

	.header-title {
		padding: 10px 0 20px 0;
		border-bottom: 1px solid #D2D2D2;
	}

	.header-title .border {
		width: 15px;
		height: 30px;
		background-color: #0064E4;
		margin-right: 20px;
		float: left;
	}

	.header-title p {
		float: left;
		font-weight: bold;
		line-height: 30px;
	}

	.header-title .opt span {
		float: left;
		margin-right: 20px;
		padding: 10px 20px;
		border: 1px solid #000;
		border-radius: 20px;
		cursor: pointer;
	}

	.pageBox {
		margin-top: 20px;
	}

	.bg-purple {
		background-color: pink;
	}
</style>
